<template>
  <div>
    <!-- 需求计划汇总查询N+1 -->
    <TopFilter
      :list="topFilterList"
      :cols="3"
      @filterChange="changeHandle"
      @onCollapse="collapseHandle"
      :labelWidth="110"
    ></TopFilter>

    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onRowSelectChange="selectChangeHandle"
      :onColumnsChange="columns => this.columns = columns"
    >
      <template slot="controls" slot-scope="props">

      </template>
    </FilterTable>

    <BaseDialog
      :visible.sync="issearch"
      :title="'详情'"
      destroyOnClose
      :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}"

    >
      <ownerSeacher  :rowData="formData" @close="emitcloseHandler" />
    </BaseDialog>



  </div>
</template>
<script>
import ownerSeacher from './ownerSeacher';
export default {
  name:'TemplateDistribution',
  data(){
    this.BaseTable=null;
    return{
      topFilterList:this.createdFrom(),
      columns:this.createdTable(),
      fetchParams:{

      },
      fetchApi:()=>{},
      formData:{},
      issearch:false,
    }
  },
  components: {
    ownerSeacher,
  },
  mounted(){
    this.BaseTable = this.$refs.table.$refs.pageTable;
  },
  created(){

  },
  methods:{
    createdFrom(){
      return [
        {
          type: 'INPUT',
          label: '选择经销商',
          fieldName: 'jxsdm1',
          placeholder: '请选择',
          unitRender: () => {
            return (
              <div>
                <el-button icon="el-icon-search" onClick={() => this.seacherFun()}></el-button>
              </div>
            );
          }
        },
        {
          type: 'INPUT',
          label: 'VIN号',
          fieldName: 'vin',
          placeholder: '请输入',
        },
        {
          type: 'RANGE_DATE',
          label: '开票日期',
          fieldName: 'kprq',
          placeholder: '请选择',
          initialValue:[]
        },
        {
          type: 'INPUT',
          label: '零售订单号',
          fieldName: 'lsddh',
          placeholder: '请输入',
        },
        {
          type: 'INPUT',
          label: '客户名称',
          fieldName: 'khmc',
          placeholder: '请输入',
        },
        {
          type: 'INPUT',
          label: '发票号',
          fieldName: 'fph',
          placeholder: '请输入',
        },
        {
          type: 'SELECT',
          label: '车系名称',
          fieldName: 'cxmc',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '车型名称',
          fieldName: 'cxmc2',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '配置名称',
          fieldName: 'pzmc',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '选装名称',
          fieldName: 'xzmc',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '内饰',
          fieldName: 'ns',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '外色',
          fieldName: 'ws',
          placeholder: '请选择',
          itemList:[]
        },
        {
          type: 'SELECT',
          label: '发票状态',
          fieldName: 'syb',
          placeholder: '请选择',
          itemList:[]
        },


      ]
    },
    createdTable(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },

        {
          title: '是否差异',
          dataIndex: 'sfcy',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],
          render: props => {
            return <span style="background:red">{props.row.sfcy}</span>;
          }
        },
        {
          title: '发票状态',
          dataIndex: 'fpzt',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],

        },
        {
          title: '经销商代码',
          dataIndex: 'jxsdm',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],

        },
        {
          title: '经销商名称',
          dataIndex: 'jxsmc',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],

        },
        {
          title: '事业部',
          dataIndex: 'syb',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],
        },
        {
          title: '办事处',
          dataIndex: 'bsc',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '零售单号',
          dataIndex: 'lsdh',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],

        },
        {
          title: 'VIN',
          dataIndex: 'vin',align: 'center',
          width: 180,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: 'CMS上报数据',
          dataIndex: 'cmssbsj',
          sorter: true,
          filter: true,
          align:'center',
          filterType: 'input',
          children:[
            {
              title: '开票时间',
              dataIndex: 'kpsj1',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '开票价格',
              dataIndex: 'kpjg1',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '发票号',
              dataIndex: 'fph1',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '开票姓名',
              dataIndex: 'kpxm1',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '身份证号',
              dataIndex: 'sfzh1',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '发票预览',
              dataIndex: 'bsc1',
              sorter: true,
              filter: true,
              filterType: 'input',
              render: props => {
                return <a >{props.row.bsc1}</a>;
              }
            },
          ]
        },
        {
          title: '税控系统数据',
          dataIndex: 'cmssbsj',
          sorter: true,
          filter: true,
          align:'center',
          filterType: 'input',
          children:[
            {
              title: '开票时间',
              dataIndex: 'kpsj2',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '开票价格',
              dataIndex: 'kpjg2',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '发票号',
              dataIndex: 'fph2',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '开票姓名',
              dataIndex: 'kpxm2',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '身份证号',
              dataIndex: 'sfzh2',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '发票预览',
              dataIndex: 'bsc2',
              sorter: true,
              filter: true,
              filterType: 'input',
              render: props => {
                return <a >{props.row.bsc2}</a>;
              }
            },
          ]
        },
        {
          title: '信息对比',
          dataIndex: 'xxdb',
          sorter: true,
          filter: true,
          align:'center',
          filterType: 'input',
          children:[
            {
              title: '价格错误',
              dataIndex: 'jgcw',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '姓名错误',
              dataIndex: 'xmcw',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '开票时间错误',
              dataIndex: 'kpsjcw',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
            {
              title: '身份证号错误',
              dataIndex: 'sfzhcw',
              sorter: true,
              filter: true,
              filterType: 'input'
            },
          ]
        }
      ]
    },
    selectChangeHandle(row){

    },
    seacherFun(){
      this.issearch=true;
    },
    async addHandle(type){
      if(type==1){
        await this.$confirm('是否通过?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        }).then(async () => {

        })
        .catch(()=>{})
      }else{
        this.isreject=true;
      }
    },
    changeHandle(params){
      this.fetchParams=Object.assign({},this.fetchParams,params)
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.BaseTable.EXECUTE_RESET_HEIGHT();
      });
    },
    editHandle(data){
      this.visible=true
    },
    emitcloseHandler(){
      this.visible=false
      this.fetchParams=Object.assign({},this.fetchParams,params)
    }
  }
}
</script>
